A widget for InstantSearch iOS that lets users enter a search query.
SearchBox
..searchAsYouType
or .searchOnSubmit
.SearchBox
components and connect them manually, you can use the following components:
Searcher
: the Searcher
that handles your searches.SearchBoxInteractor
: the logic that handles new search inputs.SearchBoxController
: the controller interfacing with a concrete input view.TextFieldController
and SearchBarController
, work well with UIKit.
If you want to use another component, such as a third-party input view, or introduce custom behaviors to UIKit components, you can create a controller that conforms to the SearchBoxController
protocol.
var onQueryChanged: ((String?) -> Void)?
:
Closure you should call when the query is modified.
var onQuerySubmitted: ((String?) -> Void)?
Closure you should call when the query is submitted.
func setQuery(_ query: String?)
Function called when the query is modified from the outside.
SearchBar
SwiftUI view, which you can embed in your views.
It uses SearchBoxObservableController
as a data model, which implements the SearchBoxController
protocol for SwiftUI.
SearchBoxObservableController
must be connected to the SearchBoxConnector
or SearchBoxInteractor
like any other SearchBoxController
implementation.
SearchBoxObservableController
as a data model.
It provides the query
property along with the submit
function to streamline the design process of your custom SwiftUI view.